﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using clf.weighing.entity;


namespace weighing
{
    public class ScaleSeriesDao : BaseDao<ScaleSeries>
    {
        #region instance

        private static ScaleSeriesDao? instance;
        public static ScaleSeriesDao Instance => instance ??= new ScaleSeriesDao();

        public override string GetTableName()
        {
            return TableName.scale_series.ToString();
        }
        #endregion


        public List<ScaleSeries> GetList()
        {
            String sql = SqlBuilder.GetSelectSqlWithSoftDeleteCondition(GetTableName());
            var data = Sqlite.Select<ScaleSeries>(sql);
            return data;
        }

        public List<ScaleSeries> GetListByBrandId(Int64 brandId)
        {
            String condition = ScaleSeriesField.brand_id.ToString() + $"= {brandId}";
            String sql = SqlBuilder.GetSelectSqlWithSoftDeleteCondition(GetTableName(), null, condition);
            var data = Sqlite.Select<ScaleSeries>(sql);
            return data;
        }

    }
}
